/*
 * Hospedagem.java
 *
 * Created on October 7, 2007, 10:49 PM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package petstore.model;

import java.util.Collection;
import java.util.Date;
import javax.persistence.AttributeOverride;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * Entity class Hospedagem
 * 
 * @author Tom Hayden
 */
@Entity
@Table(name = "hospedagem")
@AttributeOverride(name="id", column=@Column(name="cdhospedagem"))
public class Hospedagem extends BusinessObject {

    @Column(name = "dtincio")
    @Temporal(TemporalType.DATE)
    private Date dataIncio;

    @Column(name = "dttermino")
    @Temporal(TemporalType.DATE)
    private Date dataTermino;

    @Column(name = "vlrtothospedagem")
    private Double valorTotal;

    @Column(name = "ativo")
    private boolean active;

    @ManyToOne
    @JoinColumn(name="cdbaia")
    private Baia baia;

    @ManyToOne
    @JoinColumn(name="cdfuncionario")
    private Funcionario funcionario;

    @ManyToOne
    @JoinColumn(name="cdcliente")
    private Cliente cliente;
    
    @OneToMany(cascade = CascadeType.ALL)
    private Collection<Hospede> hospedes;

    /** Creates a new instance of Hospedagem */
    public Hospedagem() {
    }

    public Date getDataIncio() {
        return dataIncio;
    }

    public void setDataIncio(Date dataIncio) {
        this.dataIncio = dataIncio;
    }

    public Date getDataTermino() {
        return dataTermino;
    }

    public void setDataTermino(Date dataTermino) {
        this.dataTermino = dataTermino;
    }

    public Double getValorTotal() {
        return valorTotal;
    }

    public void setValorTotal(Double valorTotal) {
        this.valorTotal = valorTotal;
    }

    public boolean isActive() {
        return active;
    }

    public void setActive(boolean active) {
        this.active = active;
    }

    public Baia getBaia() {
        return baia;
    }

    public void setBaia(Baia baia) {
        this.baia = baia;
    }

    public Funcionario getFuncionario() {
        return funcionario;
    }

    public void setFuncionario(Funcionario funcionario) {
        this.funcionario = funcionario;
    }

    public Cliente getCliente() {
        return cliente;
    }

    public void setCliente(Cliente cliente) {
        this.cliente = cliente;
    }

    public Collection<Hospede> getHospedes() {
        return hospedes;
    }

    public void setHospedes(Collection<Hospede> hospedes) {
        this.hospedes = hospedes;
    }

}
